using System.Collections;
using System.Security.AccessControl;

namespace CSharpPro1._1023;

public class Demo
{
    //冒泡排序
    public  void TestPrint(int[] array)
    {
        int n = array.Length;
        for (int i = 0; i < n - 1; i++)
        {
            var swapped = false;
            for (int j = 0; j < n - i - 1; j++)
            {
                if (array[j] > array[j + 1])
                {
                    (array[j], array[j + 1]) = (array[j + 1], array[j]);
                    swapped = true;
                }   
            }

            if (!swapped)
            {
                break;
            }
        }
    }

    public void TestPrint2()
    {
        int[] arr =  new int[5];
        arr[0] = 1;
        arr[4] = 2;
        arr[3] = 3;
        Console.WriteLine(arr[3]);
        int[,] arr2 =
        {
            { 1, 2 },
            { 3, 4 },
            { 5, 6 }
        };
        int[,] arr3=new int[3,3];
        arr3[0, 0] = 1;
        arr3[1, 0] = 2;
        arr3[2, 0] = 3;
        
    }

    public void TestPrint3()
    {
        Hashtable hashtable = new Hashtable();
        hashtable.Add("name","张三");
        hashtable.Add("age", 21);
        hashtable.Add("sex","男");
        foreach (var item in hashtable)
        {
            Console.WriteLine(item);
            Console.WriteLine();
        }
    }
}